package cc.comac.mom.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipDevCategoryService;
import cc.comac.mom.bean.EquipDevCategory;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.util.ResultBean;

@RestController
@RequestMapping("/EquipDevCategory")
public class EquipDevCategoryController {
	
	@Autowired
	private EquipDevCategoryService equipDevCategoryService;
	
	@RequestMapping(value = "/insert",method = RequestMethod.POST)
	public ResultBean insert (@RequestBody EquipDevCategory equipDevCategory) {
		ResultBean resultBean = new ResultBean(true);
			resultBean = equipDevCategoryService.insert(equipDevCategory);
		return resultBean;
	}
	
	@RequestMapping(value = "/update",method = RequestMethod.POST)
	public ResultBean update (@RequestBody EquipDevCategory equipDevCategory) {
		ResultBean resultBean = new ResultBean(true);
			resultBean = equipDevCategoryService.update(equipDevCategory);
		return resultBean;
	}
	
	@RequestMapping(value = "/batchDelete",method = RequestMethod.POST)
	public ResultBean batchDelete (@RequestBody List<EquipDevCategory> list) {
		ResultBean resultBean = equipDevCategoryService.batchDelete(list);
		return resultBean;
	}
	@RequestMapping(value = "/selectByFields",method = RequestMethod.POST)
	public ResultBean selectByFields (@RequestBody EquipDevCategory equipDevCategory) {
		ResultBean resultBean = new ResultBean(true);
		ResultDev selectByFields = equipDevCategoryService.selectByFields(equipDevCategory);
		resultBean.setObject(selectByFields);
		return resultBean;
	}
	
	@RequestMapping( value = "/selectAll",method = RequestMethod.POST)
	public ResultBean selectAll() {
		ResultBean resultBean = new ResultBean(true);
		ResultDev selectAll = equipDevCategoryService.selectAll();
		resultBean.setObject(selectAll);
		return resultBean;
	}
	

}
